<template>
  <div class="centerApp">
    <!--登录弹出框-->
    <div class="center">
      <p>微视频管理后台</p>
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <b>登录</b>
        </div>
        <el-form ref="form" :model="user" label-width="80px">
          <el-input placeholder="请输入账号" prefix-icon="el-icon-user" v-model="user.code"></el-input>
          <el-input
            placeholder="请输入密码"
            show-password
            type="password"
            prefix-icon="el-icon-goods"
            v-model="user.password"
          ></el-input>

          <el-divider>
            <!-- <i class="el-icon-mobile-phone"></i> -->
          </el-divider>

          <el-col :span="24" style="margin-bottom: 20px">
            <el-button
              style="width: 100%"
              type="primary"
              plain
              @click="login"
            >登 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;录</el-button>
          </el-col>
        </el-form>
      </el-card>
    </div>
  </div>
</template>

<script>
export default {
  name: "login",
  data() {
    return {
      denglu1: true,
      user: {
        code: "", //账号
        password: "" //密碼
      },
      verifyCode: ""
    };
  },
  mounted() {
    // this.getCode();
  },
  methods: {
    //管理员登录
    login() {
      var that = this;
      that.$axios
        .post(
          "apis/admin/login",
          this.$qs.stringify({
            admin_account: that.user.code, //管理员账号
            admin_pwd: that.user.password //管理员密码
          })
        )
        .then(function(res) {
          console.log(res);
          if (res.status == 200) {
            if (res.data.status == 1) {
              that.$cookie.set("userAdmin", JSON.stringify(res.data.data));
              that.$router.push({ path: "./index" });
            } else if (res.data.status == 0) {
              that.$message.error("密码错了哦~");
              that.user = {};
            }
          }
        })
        .catch(function(error) {
          console.log(error);
        });
    }
  }
};
</script>

<style scoped lang="less">
.centerApp {
  height: 100%;
  width: 100%;
  background: url("../assets/home/bg.jpg") no-repeat;
  background-size: 100% 100%;
  background-position-y: 20%;
  // -webkit-filter: blur(15px);
  // -moz-filter: blur(15px);
  // -o-filter: blur(15px);
  // -ms-filter: blur(15px);
  // filter: blur(15px);
  /deep/ .el-card {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
  }
  /deep/ .el-input__inner {
    background-color: transparent;
  }
  /deep/ .el-button--primary.is-plain {
    color: #fff;
    background: transparent;
  }
}
.last {
  height: 40px;
}
.ap {
  text-align: right;
  line-height: 60px;
  padding-bottom: 10px;
  font-size: 14px;
  a {
    color: rgb(0, 110, 255);
  }
}
.center {
  width: 25%;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  p {
    font-size: 24px;
    font-weight: 500;
    line-height: 60px;
    color: #fff;
  }
  .text-center {
    height: 100%;
  }
  .tupian {
    margin-left: 5px;
    width: 100%;
    img {
      border-radius: 5px;
    }
  }
  .el-input {
    margin-bottom: 20px;
  }
}
</style >